var Module = require("../../../class/user/module.c");
var _Module = new Module();
module.exports = {
    prefix: "/module/",
    get: {
        "list": {
            des: {
                name: "getModuleListAll",
                content: "获取所有版块列表",
                params: []
            },
            method: function* () {
                var self = this;
                print("获取所有版块列表");
                try {
                    var _list = yield _Module.getAll();
                    self.body = _list;
                } catch (e) {
                    self.body = printError(e);
                };
            }
        },
        "info/:_id": {
            des: {
                name: "getModuleInfo",
                content: "获取版块信息",
                params: [
                    {
                        params: "_id",
                        type: "string"
                    }
                ]
            },
            method: function* () {
                var self = this;
                print("获取版块信息");
                try {
                    var _id = self.params._id;
                    var _info = yield _Module.detail(_id);
                    self.body = _info;
                } catch (e) {
                    self.body = printError(e);
                };
            }
        }
    }
}